package com.lj.service;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.List;

import com.lj.dao.BaseDao;
import com.lj.dao.BorrowBooksmpl;
import com.lj.entity.BorrowBooks;

public class AdminBorrowBook {
	private  BorrowBooksmpl  bbs;
	/**
	 * 添加借书信息
	 * @param borrowbooks
	 * @return
	 */
	public int addBorrowBooks(BorrowBooks borrowbooks){
			bbs= new BorrowBooksmpl();
			int count = 0 ;
			count =  bbs.addBorrowBooks(borrowbooks);
			return  count;
	}
	/**
	 * 还书
	 * @param user_id
	 * @param book_id
	 * @return
	 */
	public int DeleteBooksById(int user_id , int book_id){	
		bbs= new BorrowBooksmpl();
		int count = 0 ;
		count =  bbs.DeleteBorrowBooksById(user_id, book_id);
		return  count;
	}
	/**
	 * 在图书表查看书有谁借了
	 * @param book_id
	 * @return
	 */
	public List<BorrowBooks> findBorrowBooksByBookId(int book_id){
		bbs= new BorrowBooksmpl();
		List<BorrowBooks> list =new ArrayList<BorrowBooks>();
		list = bbs.findBorrowBooksByBookId(book_id);
		return list;
	}
	/**
	 * 在用户表查看他借了什么书
	 * @param user_id
	 * @return
	 */
	public List<BorrowBooks> findBorrowBooksByUserId(int user_id){
		bbs= new BorrowBooksmpl();
		List<BorrowBooks> list =new ArrayList<BorrowBooks>();
		list = bbs.findBorrowBooksByUserId(user_id);
		return list;
	}
}
